package com.zxx.pattern.visitorPattern.visitor1;

/**
 * 电脑实体类（5.对象结构）
 *
 * @author zxx on 2021/4/22
 */
public class BeanComputer {

    ComputerPart[] parts;

    public BeanComputer() {
        this.parts = new ComputerPart[]{new BeanKeyboard(), new BeanMonitor(), new BeanMouse()};
    }

    public void accept(ComputerPartVisitor computerPartVisitor) {
        for (ComputerPart part : parts) {
            part.accept(computerPartVisitor);
        }

        computerPartVisitor.visit(this);
    }
}
